﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataManager.TablesManager
{
    public class AccountManager : Manager
    {
        public bool Update(ACCOUNT ac)
        {
            try
            {
                DBDataContext db = new DBDataContext();
                var query =
                    from ord in db.ACCOUNTs
                    where ord.USERID == ac.USERID
                    select ord;
                foreach (ACCOUNT ord in query)
                {
                    ord.FRIEND = ac.FRIEND;
                    ord.FULLNAME = ac.FULLNAME;
                    ord.PASS = ac.PASS;
                }
                db.SubmitChanges();
                return true;
            }
            catch (Exception e)
            {
                Logs.Write(e);
                return false;
            }
        }
    }
}
